package pl.edu.agh.winmon.hibernate;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "`" + MemoryInfo.TABLE_NAME + "`")
public class MemoryInfo implements Serializable {

	@Transient
	private static final long serialVersionUID = 7016475052845402674L;

	/**
	 * Table name.
	 */
	@Transient
	public static final String TABLE_NAME = "memory_info"; //$NON-NLS-1$

	/**
	 * Hibernate's annotation property: id.
	 */
	@Transient
	public static final String PROP_ID = "id"; //$NON-NLS-1$

	/**
	 * Database column name: id;
	 */
	@Transient
	public static final String DB_ID = PROP_ID;

	/**
	 * Hibernate's annotation property: session id.
	 */
	@Transient
	public static final String PROP_SESSION = "session"; //$NON-NLS-1$

	/**
	 * Database column name: session id;
	 */
	@Transient
	public static final String DB_SESSION = "session_id"; //$NON-NLS-1$

	@Transient
	public static final String PROP_RAM_MEMORY = "ramMemory"; //$NON-NLS-1$

	@Transient
	public static final String DB_RAM_MEMORY = "ram_memory"; //$NON-NLS-1$

	@Transient
	public static final String PROP_TOTAL_MEMORY = "totalMemory"; //$NON-NLS-1$

	@Transient
	public static final String DB_TOTAL_MEMORY = "total_memory"; //$NON-NLS-1$

	/**
	 * Id.
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = DB_ID)
	private Long id;

	/**
	 * Session related to information about Memory.
	 */
	@OneToOne(targetEntity = Session.class)
	private Session session;

	@Column(name = DB_RAM_MEMORY)
	private Long ramMemory;

	@Column(name = DB_TOTAL_MEMORY)
	private Long totalMemory;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Session getSession() {
		return session;
	}

	public void setSession(Session session) {
		this.session = session;
	}

	public Long getRamMemory() {
		return ramMemory;
	}

	public void setRamMemory(Long ramMemory) {
		this.ramMemory = ramMemory;
	}

	public Long getTotalMemory() {
		return totalMemory;
	}

	public void setTotalMemory(Long totalMemory) {
		this.totalMemory = totalMemory;
	}

}
